
<div class="titlebar">
    <div class="fn-left"><i class="iconfont icon-line-chart_icon"></i> 数据统计</div>
    <div class="fn-right">
        <form class="input-group" id="form" action="{:url('Coupon.user/user',['types' => 0,'$uid' => $uid])}">
            <input placeholder="开始时间" class="input w100 ui-date" type="text" name="starttime" readonly autocomplete="false" value="{$starttime}"/>
            <input placeholder="结束时间" class="input w100 ui-date" type="text" name="endtime" readonly autocomplete="false" value="{$endtime}"/>
            <input type="submit" value="搜索" class="button button-blue" />
        </form>
    </div>
    <div class="fn-right button-group">
        <a href="{:url('Coupon.user/user',['time' => 1,'types'=>0,'uid' => $uid])}" class="button {$time==1?'button-violet':''}">今日</a>
        <a href="{:url('Coupon.user/user',['time' => 2,'types'=>0,'uid' => $uid])}" class="button {$time==2?'button-violet':''}">昨日</a>
        <a href="{:url('Coupon.user/user',['time' => 30,'types'=>0,'uid' => $uid])}" class="button {$time==30?'button-violet':''}"">本月</a>
        <a href="{:url('Coupon.user/user',['time' => 60,'types'=>0,'uid' => $uid])}" class="button {$time==60?'button-violet':''}"">上月</a>
    </div>
</div>
<div class="cards">
    <div class="card">
        <div class="fn-left"><i class="iconfont icon-line-chart_icon"></i></div>
        <div class="fn-right fn-tar"><div class="num">{$coupon_count}</div><div class="text">优惠券数量</div></div>
    </div>
    <div class="card">
        <div class="fn-left"><i class="iconfont icon-line-chart_icon"></i></div>
        <div class="fn-right fn-tar"><div class="num">{$coupon_end_count}</div><div class="text">失效数量</div></div>
    </div>
</div>
<div class="titlebar">
    <div class="fn-left"><i class="iconfont icon-text_icon"></i>优惠券列表</div>
    <div class="fn-right">
        <form class="input-group" action="{:url('Coupon.user/user',['time' => $time,'types'=>$types,'uid' => $uid])}" method="get">
            <input type="hidden" id="store_id" name="store_id" value="{$store_id}"/>
            <input url="{:url('store.index/selectStore')}" id="selectStore" readonly placeholder="好店名称" class="input selectID" type="text" name="store_name" value="{$store_name}" />
            <input url="{:url('system/passport.user/selectUser')}" id="uid" placeholder="用户ID" class="input w100 selectID" type="text" name="uid" value="{$uid ? $uid:''}" />
            <input type="submit" value="搜索" class="button button-blue" />
        </form>
    </div>
    <div class="fn-right">
        <a href="{:url('coupon.user/user',['time' => $time,'types'=>0,'$uid' => $uid])}" class="button{if $types == 0} button-green{/if}">正常</a>
        <a href="{:url('coupon.user/user',['time' => $time,'types'=>1,'$uid' => $uid])}" class="button{if $types == 1} button-green{/if}">结束</a>
    </div>
</div>
<table class="table table-border">
    <thead>
        <tr>
            <th class="w60 fn-tac"></th>
            <th class="w140">昵称</th>
            <th>优惠券</th>
            <th>好店</th>
            <th class="w100 fn-tac">类型</th>
            <th class="w90 fn-tac">满用(￥)</th>
            <th class="w100 fn-tac">代金/折扣</th>
            <th class="w140 fn-tac">创建时间</th>
            <th class="w200 fn-tac">有效期</th>
            <th class="w70 fn-tac">删除</th>
        </tr>
    </thead>
    <tbody>
        {foreach $lists as $vo}
        <tr>
            <td class="fn-tac"><img src="{$vo.user.face}" class="w40" /></td>
            <td><a href="javascript:openwin('{:url('system/passport.user/review',['uid' => $vo.uid])}')">{$vo.user.nickname}</a></td>
            <td>
                <i class="iconfont icon-wodeqiangdan"></i><a href="javascript:openwin('{:url('coupon.user/userCoupon',['id' => $vo.id])}')">{$vo.name}</a> {if $vo.is_end}<span class="badge bg-blue">结束</span>{else}<span class="badge">正常</span>{/if}<br />
                <i class="iconfont icon-cuxiaohuodong"></i> <span class="gray">{$vo.tips}</span>
            </td>
            <td><i class="iconfont icon-home_icon"></i><a class="selectID" href="javascript:;" url="{:url('store.index/review',array('id'=>$vo.store.id))}">{$vo.store.name}</a></td>
            <td class="fn-tac"> {$vo.types == 1 ?'折扣券':'代金券'}</td>
            <td class="fn-tac"><i class="iconfont icon-renminbi1688"></i>{$vo.howmuch|money}</td>
            <td class="fn-tac">{if $vo.types}<span class="badge bg-blue">{$vo.discount}折</span>{else}<span class="badge bg-green">{$vo.price}元</span>{/if}</td>
            <td class="fn-tac">{$vo.create_time|date="Y-m-d H:i:s"}</td>
            <td class="fn-tac">{$vo.create_time + $end_time|date="Y-m-d H:i:s"}</td>
            <td class="fn-tac"><a class="button isDel" url="{:url('coupon/deleteUser',array('id'=>$vo.id))}" href="javascript:;" title="删除">删除</a></td>
        </tr>
        {/foreach}
    </tbody>
</table>
{$lists|raw}
<script type="text/javascript">
Do('base','form','layer','tip','date', function () {
    $('#form').isForm({types:1});
    $('.isDel').isDel();
    $(".selectID").win();
})
function setState(store){
    $("#store_id").val(store.id);
    $("#selectStore").val(store.store_name);
}
</script>